[Fix] Reconcile actual aligned TVList memory usage - #18330
Merged
jt2594838 merged 1 commit intoJul 29, 2026
Merged
Conversation
jt2594838
approved these changes
Jul 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Problem
#18249 made aligned MemTable bitmaps lazy, but the write-memory estimator still defensively reserved a bitmap object and bitmap-list reference for every value block. That reservation can make memory accounting larger than the objects that are actually materialized and may reject writes unnecessarily.
A newly extended column also keeps its historical value arrays as
null. Therefore, this accounting model should not charge the additional 4-byte object reference for each historical null placeholder; the reference is charged only when the value array is materialized.Fix
AlignedTVList, with an O(1)getRamSize()for the write path.The correction is:
A positive correction is reserved in both
DataRegionInfoand the MemTable; a negative correction is released from both and refreshes the storage-group status. Chunk metadata and variable-length Binary payload accounting are intentionally unchanged.Performance
The new performance UT is disabled by default and can be enabled with:
mvn -pl iotdb-core/datanode test \ -Dtest=AlignedBitmapMemoryAccountingPerformanceTest \ -Diotdb.aligned.bitmap.accounting.perf.enabled=trueDefault benchmark setup: 64 columns, 256 rows per batch, 200 warmups, 2,000 batches per round, and 5 rounds. Reconciliation is repeated internally to avoid Windows CPU timer granularity and then normalized per batch.
The measured reconciliation overhead is therefore negligible for both dense and null-heavy writes.
Verification
AlignedTVListTest: 15 passedTsFileProcessorTest: 20 passedIoTDBAlignedTVListLazyAllocationIT: 1 passed on a packaged 1C1D clustergit diff --check: passedThis PR has:
Key changed/added classes
AlignedTVList: actual materialized value-array/bitmap RAM tracking and constant-time RAM lookup.TsFileProcessor: post-write aligned RAM reconciliation.AlignedBitmapMemoryAccountingPerformanceTest: opt-in reconciliation overhead benchmark.